package Thread;

//1.继承Thread
class MyThread11 extends Thread{
    static int count;
    @Override
    public void run(){
        while (true){
            System.out.println(count++);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
public class Test11 {
    public static void main(String[] args) throws InterruptedException {
        MyThread11 t = new MyThread11();
        t.start();
        while (true){
            System.out.println("我是main线程");
            Thread.sleep(1000);
        }
    }
    public static void main1(String[] args) throws InterruptedException {
        //错误,并不是多线程,是调用我们定义的类名,而不是系统内部的
        Thread thread = new Thread();
        thread.start();
        while (true){
            System.out.println("我是main线程");
            Thread.sleep(1000);
        }
    }
}
